package startup

import (
	"os"
	"shop-admin/config"
	"shop-common/library/env"
	"shop-common/library/variables"
)

func SetupApp(mode string) error {
	if mode != "" {
		if err := os.Setenv(env.EnvName, mode); err != nil {
			return err
		}
	}

	variables.AppDebug = config.Config.Debug
	variables.MysqlSetting = config.Config.Mysql
	variables.RedisSetting = config.Config.Redis
	variables.LoggerSetting = config.Config.Logger
	variables.ZoneSetting = config.Config.Zone
	variables.TokenSetting = config.Config.Token
	return nil
}
